package com.tjian.fafa.user.base.myNetwork;


import com.tjian.util.TypeUtil;

import java.io.OutputStreamWriter;
import java.net.Socket;

public class ClientSendThread
{
    private Socket socket_class;
    private String send_string;

    public synchronized void start(Socket socket, String str0)
    {
        this.socket_class = socket;
        this.send_string = str0;
        try
        {
            OutputStreamWriter outputStreamWriter = new OutputStreamWriter(socket.getOutputStream(), "utf-8");

            System.out.println("==========,_20161114_083458,\n" + TypeUtil.typeToString("send_string", send_string));

            outputStreamWriter.write(send_string + "\n"); //将字符写入。
            outputStreamWriter.flush();//将该流中的缓冲数据刷到目的地中去。
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }

    public synchronized void start_json_fafa(Socket socket, String sendString)
    {
        this.socket_class = socket;
        this.send_string = sendString;
        try
        {
            OutputStreamWriter outputStreamWriter = new OutputStreamWriter(socket.getOutputStream());

            System.out.println("==========,_20161114_085854,\n" + TypeUtil.typeToString("send_string", send_string));

            outputStreamWriter.write(send_string + "\n"); //将字符写入。
            outputStreamWriter.flush();//将该流中的缓冲数据刷到目的地中去。
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
}
